import request from '@/utils/request'

export function getList(size, current, data) {
  return request({
    // /purchase/order/query?size='+size+'&current='+current
    url: '/purchase/order/query?size=' + size + '&current=' + current,
    method: 'post',
    data,
  })
}

// 商品接口
export function getShopping(data) {
  return request({
    // /purchase/order/query?size='+size+'&current='+current
    // goods/info/query
    url: '/goods/info/query',
    method: 'post',
    data,
  })
}
// /warehouse/info/query
export function getwarehouse(data) {
  return request({
    // /purchase/order/query?size='+size+'&current='+current
    // goods/info/query
    url: '/warehouse/info/query',
    method: 'post',
    data,
  })
}


// 订单添加
// /purchase/order/add
export function addfun(data) {
  return request({
    url: '/purchase/order/add',
    method: 'post',
    data,
  })
}

// 订单中商品添加
// /purchase/order/items/add
export function addfuntoo(data){
  return request({
    url: '/purchase/order/items/add',
    method: 'post',
    data,
  })
}

// /purchase/order/items/list?size=20&current=1&orderid=1
// 订单中查询商品 size传0,current传1 则显示全部
export function getitemlist(size,current,orderid){
	return request({
	  url: "/purchase/order/items/list?size="+size+"&current="+current+"&orderid="+orderid,
	  method: 'post',
	})
}

// 编辑
export function setorderedit(data){
  return request({
    url: "/purchase/order/edit",
    method: 'post',
    data
  })
}

// /purchase/order/items/edit
export function setorderitemedit(data){
  return request({
    url: "/purchase/order/items/edit",
    method: 'post',
    data
  })
}

//确认订单
export function confirmOrder(data) {
  return request({
    url: "/purchase/order/confirm",
    method: 'post',
    data
  })
}

//订单收货
export function doneOrder(data) {
  return request({
    url: "/purchase/order/done",
    method: 'post',
    data
  })
}

//关闭订单
export function closeOrder(data) {
  return request({
    url: "/purchase/order/close",
    method: 'post',
    data
  })
}
//取消订单
export function cancelOrder(data) {
  return request({
    url: "/purchase/order/edit",
    method: 'post',
    data
  })
}
//订单商品发货
export function delivery(data) {
  return request({
    url: "/purchase/order/items/edit",
    method: 'post',
    data
  })
}
//生成退货单。
export function rebackGoods(data) {
  return request({
    url: "/sales/order/return/items/add",
    method: 'post',
    data
  })
}
export function salesLists(data) {
  return request({
    url: "/sales/order/return/items/list",
    method: 'post',
    data
  })
}